#include        <stdlib.h>
#include        <sys/types.h>
#include        <dirent.h>
#include        <unistd.h>
#include        "my.h"

int		no_options(struct dirent *d, DIR *dirp, struct stat sb, t_list **list)
{
  while ((d = readdir(dirp)) != NULL)
    {
      if (d == NULL)
	my_put_error("Readdir function failed\n");
      if (d->d_name[0] != '.')
	{
	  my_putstr(d->d_name);
	  my_putchar(' ');
	}
    }
  my_putchar('\n');
  return (0);
}

int		option_l(struct dirent *d, DIR *dirp, struct stat sb, t_list **list)
{
  while ((d = readdir(dirp)) != NULL)
    {
      if (d == NULL)
	my_put_error("Readdir function failed\n");
      stat(d->d_name, &sb);
      fill_list(list, sb, d);
      /* my_putstr(d->d_name); */
      /* my_putchar('\n'); */
    }
  return (0);
}

int		option_a(struct dirent *d, DIR *dirp, struct stat sb, t_list **list)
{
  while ((d = readdir(dirp)) != NULL)
    {
      if (d == NULL)
	my_put_error("Readdir function failed\n");
      my_putstr(d->d_name);
      my_putchar(' ');
    }
  my_putchar('\n');
  return (0);
}
